<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');?>
        <!-- bread crumb -->
		<p id="bread-crumb">
			<a href="javascript:void(0);" onclick="getBudget(-1);">Báo cáo Tài chính</a>
			<?php echo $groupname;?>
		</p><!-- end bread crumb -->
		<input type="hidden" name="budget_type" id="budget_type" value="<?php echo $groupid;?>" />
		<table cellpadding="3" cellspacing="1" width="100%">
		<tr>
			<td style="background: #999;border-right:1px solid #fff;padding:5px 5px">
				<?php echo $lang['sys_money_total'].': '.number_format($summary->ad);?> VND
			</td>
			<td style="background: #999;border-right:1px solid #fff;padding:5px 5px">
				<?php echo $lang['sys_money_use'].': '.number_format($summary->sub);?> VND
			</td>
			<td style="background: #999;padding:5px 5px">
				<?php echo $lang['sys_promotion'].': '.number_format($summary->promotion)?> VND
			</td>
		</tr>
		</table>
		<br />
		<table class="tbl-list tbpadd" width="100%" border="1">
			<tr>
				<td width="5%" class="td-label" style="text-align:center">
					<b>#</b>
				</td>
				<td width="30%" class="td-label">
					<b><?php echo $lang['date']?></b>
				</td>
				<td class="td-label" style="text-align:right">
					<b><?php echo $lang['money_ad']?> (VND)</b>
				</td>
				<td class="td-label" style="text-align:right">
					<b><?php echo $lang['money_sub']?> (VND)</b>
				</td>
				<td class="td-label" style="text-align:right">
					<b><?php echo $lang['money_promotion']?> (VND)</b>
				</td>
			</tr>
			<?php $i = 0; foreach ($items as $item){ $i++;?>
			<tr>
				<td style="text-align:center">
					<?php echo $i;?>
				</td>
				<td>
					<?php echo date('d-m-Y', strtotime($item->dt));?>
				</td>
				<td style="text-align:right">
					<?php echo number_format($item->ad);?>
				</td>
				<td style="text-align:right">
					<?php echo number_format($item->sub);?>
				</td>
				<td style="text-align:right">
					<?php echo number_format($item->promotion);?>
				</td>
			</tr>
			<?php }?>
			<tr>
				<td colspan="2" class="td-label" style="text-align:right">
					<b><?php echo $lang['sum'];?>:</b>
				</td>
				<td class="td-label" style="text-align:right">
					<b><?php echo number_format($summary->ad);?></b>
				</td>
				<td class="td-label" style="text-align:right">
					<b><?php echo number_format($summary->sub);?></b>
				</td>
				<td class="td-label" style="text-align:right">
					<b><?php echo number_format($summary->promotion);?></b>
				</td>
			</tr>
		</table>
		<br />
		<div style="clear:both; height:10px;"><span></span></div>
        <div id="charClick1" class="chart"></div>
<script language="javascript">
	var addCommasNumber=function addCommas(nStr)
	{
		nStr += '';
		x = nStr.split('.');
		x1 = x[0];
		x2 = x.length > 1 ? '.' + x[1] : '';
		var rgx = /(\d+)(\d{3})/;
		while (rgx.test(x1)) {
			x1 = x1.replace(rgx, '$1' + ',' + '$2');
		}
		return x1 + x2;
	}
	<?php if(isset($chart1->label) && count($chart1->label) > 0){?>
	   var chart1 = new Highcharts.Chart({
	      chart: {
	         renderTo: 'charClick1',
	         defaultSeriesType: 'spline'
	      },
	      title: {
	         text: 'Báo cáo tài chính (từ <?php echo date('d/m/Y', strtotime($startdate));?> đến <?php echo date('d/m/Y', strtotime($enddate));?>)'
	      },
	      subtitle: {
	         text: ''
	      },
	      xAxis: {
	         categories: ['<?php echo implode("','", $chart1->label);?>'],
	         tickInterval: <?php $step = (int)(count($chart1->label)/4); echo ($step > 0 ? $step : 1);?>,
			     gridLineWidth: 0
		      },
		      yAxis: {
		         title: {
		            text: 'Tài chính'
		         },
		         labels: {
		            formatter: function() {
		               return addCommasNumber(this.value)
		            }
		         },
		         min: 0
		      },
		      tooltip: {
		         crosshairs: true,
		         shared: true,
		         formatter: function()
		         {
		             var s = '<b>Ngày '+ this.x +'</b>';
		             $.each(this.points, function(i, point) {
		                 s += '<br/>'+ point.series.name +': '+addCommasNumber(point.y)+' đ';
		             });
		             
		             return s;
		         }
		      },
		      plotOptions: {
	            spline: {
	               marker: {
	                  enable: false
	               }
	            }
	         },
	      series: [{
	         name: 'Đã nạp',
	         data: [<?php echo implode(',', $chart1->ad);?>]
	      }, {
	         name: 'Đã tiêu',
	         data: [<?php echo implode(',', $chart1->sub);?>]
	      }, {
	         name: 'Khuyễn mãi',
	         data: [<?php echo implode(',', $chart1->promotion);?>]
	      }],
	      exporting: {
	          enabled: false
	      }
	   });
	   <?php } else {?>
		$('#charClick1').html('Chưa có dữ liệu trả về');
	   <?php }?>
</script>